define(function(require, exports, module) {
    var ALL = require("../../common/all"),
        CONFIG = ALL.CONFIG,
        METHOD = ALL.METHOD,
        Dialog = ALL.Dialog,
        Init = ALL.Init;

    var _Dialog = new Dialog({
        title : "提示",
        content : "<p>是否确认复牌？</p>",
        text4Btn: ["确定", "取消"],
        class4Btn: ["", "line"]
    });

    var _vm = Init.initVue({
        data : {
            list : [],
            schFlag : false,
            name : '',
            type : '',
            status : '',
            cur : 1,
            all : 0,
            typeList : [],
        },
        methods: {
            reSearch : function() {
                this.schFlag = true;
                this.getData(1);
            },
            reset : function() {
                this.schFlag = false;
                this.name = '';
                this.type = '';
                this.status = '';
            },
            getData : function(n) {
                var obj = {
                    page: n,
                    num: 10,
                    name: this.name,
                    type: this.type,
                    status: this.status
                };

                METHOD.loading.show();
                METHOD.ajax("collection/list_issued",obj).done(function(json){
                    METHOD.loading.hide();
                    _vm.list = json.data;
                    _vm.all = json.page.pages;
                }).fail(function(){
                    METHOD.loading.hide();
                });
            },
            operate : function(id,status) {

                _Dialog.showUI(function(i) {
                    var obj = { col_id : id, status : status };

                    if (i == 0) {
                        METHOD.loading.show();
                        METHOD.ajax("collection/operate/resumed", {data:JSON.stringify(obj)}, {type:"post"}).done(function(json){
                            METHOD.loading.hide();
                            _vm.getData(1);
                        }).fail(function(){
                            METHOD.loading.hide();
                        });
                    }
                    this.hideUI();
                });
            }
        }
    });

    _vm.getData(1);

    METHOD.loading.show();
    METHOD.ajax("coltype/type_list",{type : 2}).done(function(json){
        METHOD.loading.hide();
        _vm.typeList = json.data;
    }).fail(function(){
        METHOD.loading.hide();
    });

});

